package cat.joronya.supermanager;

import java.util.ArrayList;

import cat.joronya.supermanager.home.HomeActivity;
import cat.joronya.supermanager.market.MarketListActivity;
import cat.joronya.supermanager.privateleague.PrivateLeague;
import cat.joronya.supermanager.privateleague.PrivateLeagueListActivity;
import cat.joronya.supermanager.team.MyTeamsListActivity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class SupermanagerActivity extends TabActivity 
{
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
    	super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Resources res = getResources();
        TabHost tabHost = getTabHost();
        TabHost.TabSpec spec;
        Intent intent;

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, HomeActivity.class);
        //intent.putExtra("cat.joronya.supermanager.jornada", "29");//synchronizer.jornada);
        //intent.putExtra("cat.joronya.supermanager.nextjornada", "Jornada 30");//synchronizer.nextJornada);
        //intent.putExtra("cat.joronya.supermanager.duetime", "Sabado 16/04 17h.");//synchronizer.duetime);
        spec = tabHost.newTabSpec("home").setIndicator(res.getString(R.string.home_tab),
                          res.getDrawable(R.drawable.ic_tab_home))
                      .setContent(intent);
        tabHost.addTab(spec);

        // Private leagues activity
        intent = new Intent().setClass(this, PrivateLeagueListActivity.class);
        intent.putExtra("cat.joronya.supermanager.jornada", "29");//synchronizer.jornada);
        intent.putExtra("cat.joronya.supermanager.privateleagues", new ArrayList<PrivateLeague>());//synchronizer.privateLeagues);
        spec = tabHost.newTabSpec("privateLeague").setIndicator(res.getString(R.string.private_league_list_tab),
                          res.getDrawable(R.drawable.ic_tab_privateleague))
                      .setContent(intent);
        tabHost.addTab(spec);

        // Market activity
        intent = new Intent().setClass(this, MarketListActivity.class);
        spec = tabHost.newTabSpec("market").setIndicator(res.getString(R.string.market_tab),
                          res.getDrawable(R.drawable.ic_tab_market))
                      .setContent(intent);
        tabHost.addTab(spec);
        
        // My teams activity
        intent = new Intent().setClass(this, MyTeamsListActivity.class);
        spec = tabHost.newTabSpec("myTeams").setIndicator(res.getString(R.string.my_teams_tab),
                          res.getDrawable(R.drawable.ic_tab_team))
                      .setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(0);
    }    
}